package com.source.lightfowl.syslog.dao;

/**
 * @Author: 谢春泳
 * @Description:
 * @Date: 2020/2/25 23:33
 */

import com.source.lightfowl.syslog.pojo.Operation;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author: 谢春泳
 * @Description: 操作日志的持久层接口
 * @Date: 2020/2/25 15:25
 */
public interface OperationDao extends JpaRepository<Operation,String>, JpaSpecificationExecutor<Operation> {
    @Modifying
    @Transactional
    @Query("delete from Operation l where l.id in(?1)")
    void deleteBatch(ArrayList<String> ids);

    @Query("from Operation l where l.userId = (?1)")
    List<Operation> findByPersonId(String id);


}